package com.example.qy137login.service.serviceimpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.qy137login.dao.StaffDao;
import com.example.qy137login.entity.Staff;
import com.example.qy137login.service.StaffService;
import com.example.qy137login.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: qy137-login
 * @description: service实现类
 * @author: 王子鑫
 * @create: 2021-08-27 18:25
 **/
@Service
public class StaffServiceImpl implements StaffService {
    @Autowired
    private StaffDao staffDao;

    @Override
    public Result loginByUsernameAndPassword(String username, String password) {
        QueryWrapper<Staff> staffQueryWrapper = new QueryWrapper<>();
        staffQueryWrapper.eq("username",username);
        staffQueryWrapper.eq("password",password);
        Staff staff = staffDao.selectOne(staffQueryWrapper);
        if (staff!=null){
            return Result.success();
        }else {
            return Result.fail();
        }
    }
}

